@extends('layouts.appManager')

@section('content')
    <div class="container py-5">
        <div class="row justify-content-center">
            <div class="col-md-8">
                <form method="POST" action="{{ route('server_v2.store') }}">
                    @csrf
                    <div class="card panel">
                        <div class="card-header">基本信息配置</div>

                        <div class="card-body">

                            <div class="form-group row">
                                <label for="name" class="col-md-4 col-form-label text-md-right">服务器名称 <span class="text-danger">*</span></label>

                                <div class="col-md-6">
                                    <input id="name" type="text" class="form-control @error('name') is-invalid @enderror" name="name" value="{{ old('name') }}" autocomplete="name" autofocus maxlength="20" required>

                                    @error('name')
                                    <span class="invalid-feedback" role="alert">
                                            <strong>{{ $message }}</strong>
                                        </span>
                                    @enderror
                                </div>
                            </div>

                            <div class="form-group row">



                                <label for="domain" class="col-md-4 col-form-label text-md-right">域名 <span class="text-danger">*</span></label>

                                <div class="col-md-6">

                                    <div class="input-group">
                                        <div class="input-group-prepend is-invalid ">
                                            <span class="input-group-text">http://</span>
                                        </div>
                                        <input id="domain" type="text" class="form-control @error('domain') is-invalid @enderror" name="domain" value="{{ old('domain') }}" autocomplete="domain" maxlength="10" required>
                                        <div class="input-group-append is-invalid ">
                                            <span class="input-group-text" >.{{config('conf.domain')}}</span>
                                        </div>
                                        @error('domain')
                                        <span class="invalid-feedback" role="alert">
                                            <strong>{{ $message }}</strong>
                                        </span>
                                        @enderror
                                    </div>
                                    {{--<input id="domain" type="text" class="form-control @error('domain') is-invalid @enderror" name="domain" value="{{ old('domain') }}" autocomplete="domain">--}}

                                    <small class="text-secondary"> <i class="fas fa-info-circle"></i> 玩家访问的域名，不可修改，谨慎填写</small>
                                </div>

                            </div>

                            <div class="form-group row">
                                <label for="info" class="col-md-4 col-form-label text-md-right">服务端介绍</label>

                                <div class="col-md-6">
                                    <textarea id="info" rows="5" class="form-control @error('info') is-invalid @enderror" name="info" autocomplete="info">{{ old('info') }}</textarea>

                                    @error('info')
                                    <span class="invalid-feedback" role="alert">
                                            <strong>{{ $message }}</strong>
                                        </span>
                                    @enderror
                                </div>
                            </div>

                            <div class="form-group row">
                                <label for="qq_group" class="col-md-4 col-form-label text-md-right">QQ群</label>

                                <div class="col-md-6">
                                    <input id="qq_group" type="text" class="form-control @error('qq_group') is-invalid @enderror" name="qq_group" value="{{ old('qq_group') }}" autocomplete="qq_group">

                                    @error('qq_group')
                                    <span class="invalid-feedback" role="alert">
                                            <strong>{{ $message }}</strong>
                                        </span>
                                    @enderror
                                </div>
                            </div>

                            <div class="form-group row">
                                <label for="qq_group" class="col-md-4 col-form-label text-md-right">客服QQ</label>

                                <div class="col-md-6">
                                    <input id="qq_server" type="text" class="form-control @error('qq_server') is-invalid @enderror" name="qq_server" value="{{ old('qq_server') }}" autocomplete="qq_server">

                                    @error('qq_server')
                                    <span class="invalid-feedback" role="alert">
                                            <strong>{{ $message }}</strong>
                                        </span>
                                    @enderror
                                </div>
                            </div>
                        </div>
                    </div>

                    {{--            <div class="card panel">
                                    <div class="card-header">服务器配置</div>
                                    <small class="text-secondary mt-3"> <i class="fas fa-info-circle"></i> 请使用空白的 Ubuntu20.04 服务器，您将跟随向导，一步一步完成服务端的安装和配置！</small>
                                    <div class="card-body">

                                        <div class="form-group row">
                                            <label for="server_host" class="col-md-4 col-form-label text-md-right">服务器IP <span class="text-danger">*</span></label>

                                            <div class="col-md-6">
                                                <input id="server_host" type="text" v-model="server.server_host" class="form-control @error('server_host') is-invalid @enderror" name="server_host" value="{{ old('server_host') }}" autocomplete="server_host" maxlength="20" :readonly="checked" required>

                                                @error('server_host')
                                                <span class="invalid-feedback" role="alert">
                                                    <strong>{{ $message }}</strong>
                                                </span>
                                                @enderror
                                            </div>
                                        </div>

                                        <div class="form-group row">
                                            <label for="root_pwd" class="col-md-4 col-form-label text-md-right">root用户密码 <span class="text-danger">*</span></label>

                                            <div class="col-md-6">
                                                <input id="root_pwd" type="password" v-model="server.root_pwd" class="form-control @error('root_pwd') is-invalid @enderror" name="root_pwd" value="{{ old('root_pwd') }}" autocomplete="root_pwd" maxlength="20" :readonly="checked" required>

                                                @error('root_pwd')
                                                <span class="invalid-feedback" role="alert">
                                                            <strong>{{ $message }}</strong>
                                                        </span>
                                                @enderror
                                            </div>
                                        </div>

                                        <div class="form-group row">
                                            <label for="root_pwd" class="col-md-4 col-form-label text-md-right"></label>

                                            <div class="col-md-6 text-right">
                                                <button type="button" @click="serverTest()" class="btn btn-primary" :disabled="checked">
                                                    验证服务器
                                                </button>
                                            </div>
                                        </div>
                                    </div>
                                </div>--}}


                    <div class="col-md-6 offset-md-3">
                        <button type="submit" class="btn btn-primary btn-block">
                            添加
                        </button>
                    </div>

                </form>
            </div>
        </div>
    </div>
@endsection
